package c.c.a;

import android.content.ContentProviderClient;
import android.content.Context;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import c.c.a.d1.a;

public final class b1 implements d1 {
    public boolean a(Context context) {
        return VERSION.SDK_INT > 28;
    }

    public a b(Context context) {
        Uri parse = Uri.parse("content://cn.nubia.identity/identity");
        try {
            int i = VERSION.SDK_INT;
            ContentProviderClient acquireContentProviderClient = context.getContentResolver().acquireContentProviderClient(parse);
            if (acquireContentProviderClient == null) {
                return null;
            }
            Bundle call = acquireContentProviderClient.call("getOAID", null, null);
            if (i >= 24) {
                acquireContentProviderClient.close();
            } else {
                acquireContentProviderClient.release();
            }
            if (call == null) {
                return null;
            }
            if (call.getInt("code", -1) == 0) {
                a aVar = new a();
                aVar.a = call.getString("id");
                return aVar;
            }
            String string = call.getString("message");
            if (!TextUtils.isEmpty(string)) {
                Log.e(c1.j, string);
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
